/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background-color: #f8f9fa;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e9ecef;
    transition: all 0.3s ease;
    z-index: 100;
}

/* 桌面端侧边栏收起状态 */
.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar.collapsed .sidebar-header .app-logo span,
.sidebar.collapsed .new-chat-btn span,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .conversation-item .conversation-item-content span,
.sidebar.collapsed .logout-btn span,
.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0 8px;
}

.sidebar.collapsed .app-logo {
    justify-content: center;
}

.sidebar.collapsed .new-chat-btn,
.sidebar.collapsed .logout-btn {
    justify-content: center;
    padding: 8px;
    width: 44px;
    height: 44px;
    margin: 0 auto;
}

.sidebar.collapsed .conversation-item {
    justify-content: center;
    padding: 8px;
    margin: 2px 8px;
    border-radius: 8px;
}

.sidebar.collapsed .conversation-item .conversation-item-content {
    justify-content: center;
    min-width: unset;
}

.sidebar.collapsed .conversation-item .conversation-item-content i {
    margin: 0;
}

.sidebar.collapsed .conversation-item .delete-conversation-btn {
    display: none;
}

/* 收起状态下的hover效果和tooltip */
.sidebar.collapsed .new-chat-btn,
.sidebar.collapsed .logout-btn,
.sidebar.collapsed .conversation-item {
    position: relative;
}

.sidebar.collapsed .new-chat-btn:hover::after,
.sidebar.collapsed .logout-btn:hover::after,
.sidebar.collapsed .conversation-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 20px;
    color: #1f2937;
}

.app-logo i {
    font-size: 20px;
    color: #4361ee;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-section {
    padding: 16px;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: white;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.sidebar-section-title {
    padding: 8px 16px;
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    position: relative;
}

.conversation-item:hover {
    background-color: #f3f4f6;
}

.conversation-item:hover .delete-conversation-btn {
    opacity: 1;
}

.conversation-item.active {
    background-color: var(--primary-light);
    border-left-color: var(--primary-color);
}

.conversation-item i {
    margin-right: 8px;
    color: #9ca3af;
}

.delete-conversation-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.delete-conversation-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.conversation-item-content {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    color: var(--text-color);
}

.empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #9ca3af;
}

.empty-placeholder i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-placeholder p {
    font-size: 14px;
    margin-bottom: 8px;
}

.empty-placeholder .hint {
    font-size: 12px;
    opacity: 0.7;
}

.history-conversations, .archived-conversations {
    margin-top: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    margin-bottom: 8px;
    border-radius: 8px;
    background-color: #f9fafb;
    font-size: 14px;
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: white;
    color: #dc3545;
    border: 1px solid #f1f1f1;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background-color: #fff5f5;
    color: #b02a37;
    border-color: #dc3545;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #ffffff;
}

.top-nav {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #e9ecef;
}

.chat-tabs {
    display: flex;
    gap: 10px;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #6b7280;
    font-weight: 500;
    background-color: transparent;
}

.chat-tab:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.chat-tab.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.chat-tab i {
    font-size: 16px;
}

.doc-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    height: calc(100vh - 60px); /* 直接用视窗高度减去top-nav高度 */
}

.tab-panel.active {
    display: flex;
}

/* 知识库容器布局 */
.knowledge-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

/* 主容器默认显示状态 */
#chat-container,
#knowledge-container,
#documents-container,
#doc-content-container,
#add-document-container,
#settings-container {
    display: none;
}

/* 默认显示聊天容器 */
#chat-container {
    display: flex;
}

/* 添加文档容器高度约束 */
#add-document-container {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
} 